//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////


storage1array = [
"99907590",
"98845894" //Garrett

];

_vcl = _this select 0;
_art = _this select 1;

if(_art == "storegarage")then

{

if ((count crew _vcl) > 0) exitWith {player groupChat "The vehicle is not empty!"};
if(_vcl distance impoundarea2 < 30)exitwith{player groupchat "the vehicle is already impounded!"};
if(_vcl iskindof "air")exitwith{player groupchat "you cannot impound this vehicle!"};
if(_vcl distance storage1 > 10)exitwith{player groupchat "You must be at least 10 meters away from your garage!"};
_incarpark = false;

{if ((player distance (_x select 0)) < (_x select 1)) then {_incarpark = true};} forEach INV_VehicleGaragen;

if(_incarpark)exitwith{player groupchat "This vehicle is in a carpark. you cannot store it!"};

_vcl setpos [(getPos impoundarea1 select 0)-(random 20)+(random 20), (getPos storage1 select 1)-(random 20)+(random 20), getPos storage1 select 2];
_geld = 0;
['geld', _geld] call INV_AddInvItem;
player groupChat "You have stored your vehicle in your garage.";
player groupChat localize "STRS_inventar_storage_success";

_vcl setdamage 0;
_vcl engineOn false;
_vcl setvehiclelock "locked";

};

if(_art == "retrievegarage")then

{

_geld = "geld" call INV_getitemamount;

if(_geld < storagepay)exitwith{player groupchat "You do not have enough money"};

if(_uid in storage1array and count (nearestobjects [getpos ccarspawn,["Ship","car","motorcycle","truck"], 3]) > 0)exitwith{player groupchat "There is already a vehicle in your garage!"};

["geld", -storagepay] call INV_AddInvItem;

_vcl = call compile format["%1", _vcl];

if (_uid in storage1array)then

	{

	_vcl setpos getpos storage1;
	_vcl setdir getdir storage1;

	};

player groupchat format["You have successfully retrieved your vehicle from your garage!"];

};